home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / host / RCS / Host_ByID.c,v < prev    next >
Encoding:
Text File  |  1992-06-05  |  2.2 KB  |  106 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    jhh:1.2; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.2
  10. date     88.08.08.13.25.04;  author ouster;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     88.06.30.11.06.30;  author ouster;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24. 1.2
  25. log
  26. @Documentation was wrong.
  27. @
  28. text
  29. @/* 
  30.  * Host_ByID.c --
  31.  *
  32.  *    Source code for the Host_ByID library procedure.
  33.  *
  34.  * Copyright 1988 Regents of the University of California
  35.  * Permission to use, copy, modify, and distribute this
  36.  * software and its documentation for any purpose and without
  37.  * fee is hereby granted, provided that the above copyright
  38.  * notice appear in all copies.  The University of California
  39.  * makes no representations about the suitability of this
  40.  * software for any purpose.  It is provided "as is" without
  41.  * express or implied warranty.
  42.  */
  43.  
  44. #ifndef lint
  45. static char rcsid[] = "$Header: Host_ByID.c,v 1.1 88/06/30 11:06:30 ouster Exp $ SPRITE (Berkeley)";
  46. #endif not lint
  47.  
  48. #include <stdio.h>
  49. #include <host.h>
  50. #include <hostInt.h>
  51.  
  52.  
  53. /*
  54.  *-----------------------------------------------------------------------
  55.  *
  56.  * Host_ByID --
  57.  *
  58.  *    Return info about a host based on its Sprite ID.
  59.  *
  60.  * Results:
  61.  *    A pointer to a Host_Entry structure, or NULL if no machine
  62.  *    with that ID exists.  The Host_Entry is statically allocated,
  63.  *    and may be modified on the next call to any Host_ procedure.
  64.  *
  65.  * Side Effects:
  66.  *    The host database is opened if it wasn't already so.
  67.  *
  68.  *-----------------------------------------------------------------------
  69.  */
  70. Host_Entry *
  71. Host_ByID(id)
  72.     register int      id;          /* ID of machine to find */
  73. {
  74.     register Host_Entry    *entry;            /* Current entry in database */
  75.  
  76.     if (Host_Start() != 0) {
  77.     return (Host_Entry *) NULL;
  78.     }
  79.     
  80.     while (1) {
  81.     entry = Host_Next();
  82.     if (entry == (Host_Entry *) NULL) {
  83.         return entry;
  84.     } else if (entry->id == id) {
  85.         return (entry);
  86.     }
  87.     }
  88. }
  89. @
  90.  
  91.  
  92. 1.1
  93. log
  94. @Initial revision
  95. @
  96. text
  97. @d17 1
  98. a17 1
  99. static char rcsid[] = "$Header: proto.c,v 1.2 88/03/11 08:39:08 ouster Exp $ SPRITE (Berkeley)";
  100. d33 3
  101. a35 3
  102.  *    A Host_Entry structure the caller must free or NULL, if no machine
  103.  *    with that ID exists.  The Host_Entry is statically allocated, and
  104.  *    may be modified on the next call to any Host_ procedure.
  105. @
  106.